package com.myjar.excel.v2;


import com.myjar.excel.serializer.ObjectSerializer;

import java.io.Closeable;
import java.util.Collection;

public interface  _Context<T> {

    <K> void setVal(K t,ObjectSerializer<K> objectSerializer) throws Exception;

    <K> K getVal(ObjectSerializer<K> objectSerializer) throws Exception;

    int rowIndex();

    int cellIndex();

    int cellSize();

    int rowSize();

    boolean hasMoreCell();

    boolean hasMoreRow();

    // 指针操作
    void toNextLineBegin();

    void toNextCell();

    void move(int row, int cell);

    default <K> void setValAndToNextCell(K t,ObjectSerializer<K> objectSerializer) throws Exception {
        setVal(t, objectSerializer);
        toNextCell();
    }

    default <K> K getValAndToNextCell(ObjectSerializer<K> objectSerializer) throws Exception {
        K t = getVal(objectSerializer);
        toNextCell();
        return t;
    }


    void log(Throwable throwable);

    void add(T t);

    Collection<T> suc();

    Logger<T> getLogger();
}
